<?php


namespace IDock\Insurance\AICS;

use IDock\IDock\IDockInterface;
use IDock\Insurance\AICS\Request\AccidentInsuranceRequest;
use IDock\Insurance\AICS\Request\EPolicyDownloadRequest;
use IDock\Insurance\AICS\Request\FloatRateRequest;
use IDock\Insurance\AICS\Request\GetPaymentUrlRequest;
use IDock\Insurance\AICS\Request\NonCarProductListRequest;
use IDock\Insurance\AICS\Request\PolicyInfoRequest;
use IDock\Insurance\AICS\Request\PolicyPaymentRequest;
use IDock\Insurance\AICS\Request\PremiumInquiryRequest;
use IDock\Insurance\AICS\Request\ProposalRecallRequest;
use IDock\Insurance\AICS\Request\ProposalStatusRequest;
use IDock\Insurance\AICS\Request\RenewalInquiryRequest;
use IDock\Insurance\AICS\Request\SichuanVehicleModelRequest;
use IDock\Insurance\AICS\Request\UnderwritingRecallRequest;
use IDock\Insurance\AICS\Request\UnderwritingRequest;
use IDock\Insurance\AICS\Request\UploadFileRequest;
use IDock\Insurance\AICS\Request\UploadResultQueryRequest;
use IDock\Insurance\AICS\Request\VehicleModelRequest;
use IDock\Insurance\AICS\Request\VehicleTypeQueryRequest;
use IDock\Insurance\AICS\Response\AccidentInsuranceResponse;
use IDock\Insurance\AICS\Response\EPolicyDownloadResponse;
use IDock\Insurance\AICS\Response\FloatRateResponse;
use IDock\Insurance\AICS\Response\NonCarProductListResponse;
use IDock\Insurance\AICS\Response\PolicyPaymentResponse;
use IDock\Insurance\AICS\Response\PremiumInquiryResponse;
use IDock\Insurance\AICS\Response\ProposalRecallResponse;
use IDock\Insurance\AICS\Response\ProposalStatusResponse;
use IDock\Insurance\AICS\Response\RenewalInquiryResponse;
use IDock\Insurance\AICS\Response\SichuanVehicleModelResponse;
use IDock\Insurance\AICS\Response\UnderwritingRecallResponse;
use IDock\Insurance\AICS\Response\UnderwritingResponse;
use IDock\Insurance\AICS\Response\UploadFileResponse;
use IDock\Insurance\AICS\Response\UploadResultQueryResponse;
use IDock\Insurance\AICS\Response\VehicleActualValueResponse;
use IDock\Insurance\AICS\Response\VehicleModelResponse;
use IDock\Insurance\AICS\Response\VehicleTypeQueryResponse;
use IDock\Printer\NonCar\NonCarInquiryPrinter;
use IDock\Printer\NonCar\NonCarInquirySinglePrinter;
use IDock\Printer\NonCar\NonCarUnderwritingPrinter;
use IDock\Visitor\EPolicyDownloadVisitor;
use IDock\Visitor\NonCar\NonCarInquiryVisitor;
use IDock\Visitor\NonCar\NonCarProductListVisitor;
use IDock\Visitor\NonCar\NonCarProductVisitor;
use IDock\Visitor\PolicyInfoVisitor;
use IDock\Visitor\PolicyPaymentVisitor;
use IDock\Visitor\Premium\PremiumInquiryVisitor;
use IDock\Visitor\ProposalRecallVisitor;
use IDock\Visitor\ProposalStatusVisitor;
use IDock\Visitor\RenewalInquiryVisitor;
use IDock\Visitor\UnderwritingRecallVisitor;
use IDock\Visitor\UploadFileVisitor;
use IDock\Visitor\VehicleActualValueVisitor;
use IDock\Visitor\VehicleModelVisitor;

class AICSConstruct extends Builder implements IDockInterface
{
    public $config = [];

    public function __construct($config)
    {
        $this->config = $config;

        $this->userName = $config['userName'] ?? '';
        $this->password = $config['password'] ?? '';
        $this->gateway = $config['gateway'] ?? '';
        $this->WAPPayUrl = $config['WAPPayUrl'] ?? '';
        $this->ip = $config['ip'] ?? '';
    }

    /**
     * 续保查询
     * @param RenewalInquiryVisitor $renewalInquiryVisitor
     * @return RenewalInquiryResponse
     */
    public function renewalInquiry(RenewalInquiryVisitor $renewalInquiryVisitor): RenewalInquiryResponse
    {
        $request = new RenewalInquiryRequest();
        $request->setVisitor($renewalInquiryVisitor);

        /*** @var RenewalInquiryResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 车型查询
     * @param VehicleModelVisitor $vehicleModelVisitor
     * @return VehicleModelResponse
     */
    public function vehicleModel(VehicleModelVisitor $vehicleModelVisitor): VehicleModelResponse
    {
        $request = new VehicleModelRequest();
        $request->setVisitor($vehicleModelVisitor);

        /*** @var VehicleModelResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 四川车型查询
     * @param $vin
     * @param $licenseNo
     * @param string $cPlateTyp
     * @return
     */
    public function sichuanVehicleModel($vin,$licenseNo,$cPlateTyp = '02')
    {
        $request = new SichuanVehicleModelRequest();
        $request->vin = $vin;
        $request->licenseNo = $licenseNo;
        $request->cPlateTyp = $cPlateTyp;

        /*** @var SichuanVehicleModelResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 获取车辆浮动折扣
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return FloatRateResponse
     */
    public function getFloatRate(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
        $request = new FloatRateRequest();
//        global $testResponse;
/*        $testResponse = '<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:GtePriceDiscountServiceResponse xmlns:ns2="http://newWS.front.app.echannel.ebiz.alltrust.com/"><response><?xml version="1.0" encoding="UTF-8"?><responseMessage>    <code>E0000</code>    <msg>成功</msg>    <val>0.6</val></responseMessage></response></ns2:GtePriceDiscountServiceResponse></S:Body></S:Envelope>';*/
        $request->setVisitor($premiumInquiryVisitor);
        /*** @var FloatRateResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 车辆实际价格
     * @param VehicleActualValueVisitor $vehicleActualValueVisitor
     * @return VehicleActualValueResponse
     */
    public function vehicleActualValue(VehicleActualValueVisitor $vehicleActualValueVisitor): VehicleActualValueResponse
    {
        $response = new VehicleActualValueResponse();
        $response->setCode(200);
        $response->setVisitor($vehicleActualValueVisitor);
        $response->printerInit();
        return $response;
    }

    /**
     * 询价前置
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return mixed|void
     */
    public function preInquiry(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
        // TODO: Implement preInquiry() method.
    }

    public function validateCar(PremiumInquiryVisitor $premiumInquiryVisitor)
    {
        // TODO: Implement validateCar() method.
    }

    /**
     * 询价
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return PremiumInquiryResponse
     */
    public function premiumInquiry(PremiumInquiryVisitor $premiumInquiryVisitor): PremiumInquiryResponse
    {

        //global $testResponse;
        /*$testResponse = '<?xml version="1.0" ?><S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/"><S:Body><ns2:queryVehicleXnyQuotationServiceResponse xmlns:ns2="http://newWS.front.app.echannel.ebiz.alltrust.com/"><response><?xml version="1.0" encoding="UTF-8"?><responseMessage><Applicant><CAppNme>四川西部网信产业园有限公司</CAppNme><CAreaCde>103132</CAreaCde><CCertfCde>91511800740048106P</CCertfCde><CCertfCls>110004</CCertfCls><CCity>511800</CCity><CClntAddr>四川省雅安市雨城区沙湾路</CClntAddr><CClntMrk>0</CClntMrk><CCntrNme>余建强</CCntrNme><CCounty>511802</CCounty><CEmail>9051989@qq.com</CEmail><CMobile>18140044628</CMobile><CProvince>510000</CProvince><CRelCde>601005</CRelCde><CResvTxt5>002</CResvTxt5><CSex>106002</CSex><CTrdCde>2017O82</CTrdCde><CWorkDpt>300</CWorkDpt><NResvNum3>500</NResvNum3><TBirthday>0074-01-17</TBirthday><TCertfClsValiDate>9999-12-31</TCertfClsValiDate><TEffectedDate>2002-08-08</TEffectedDate><cAppCustRiskRank></cAppCustRiskRank><cAppHighRiskReason></cAppHighRiskReason></Applicant><Insured><CAreaCde>103132</CAreaCde><CCertfCde>91511800740048106P</CCertfCde><CCertfCls>110004</CCertfCls><CCity>511800</CCity><CClntAddr>四川省雅安市雨城区沙湾路</CClntAddr><CClntMrk>0</CClntMrk><CCntrNme>余建强</CCntrNme><CCounty>511802</CCounty><CEmail>9051989@qq.com</CEmail><CInsuredNme>四川西部网信产业园有限公司</CInsuredNme><CMobile>18140044628</CMobile><CProvince>510000</CProvince><CRelCdes>601005</CRelCdes><CSex>106002</CSex><CTrdCde>2017O82</CTrdCde><CWorkDpt>300</CWorkDpt><NResvNum3>500</NResvNum3><TBirthday>0074-01-17</TBirthday><TCertfClsValiDate>9999-12-31</TCertfClsValiDate><TEffectedDate>2002-08-08</TEffectedDate><cInsuredCustRiskRank></cInsuredCustRiskRank><cInsuredHighRiskReason></cInsuredHighRiskReason></Insured><Head><errorCode>000000</errorCode><errorMessage>交易成功</errorMessage></Head><Base><CAgrSlsBsns></CAgrSlsBsns><CAgtAgrSeqNO>05D700P0001601</CAgtAgrSeqNO><CAgtZgNo>203254000000800</CAgtZgNo><CBankCde></CBankCde><CBrkrNme>成都衡信业保险代理有限公司邛崃分公司</CBrkrNme><CChaClassCde></CChaClassCde><CChaClassNme></CChaClassNme><CChaNme>专业代理</CChaNme><CChaSpecail></CChaSpecail><CClientQuality>192098</CClientQuality><CDataSrc>iBusi</CDataSrc><CDptCde>05D7</CDptCde><CDutyNme></CDutyNme><CProdNoJQ>0326</CProdNoJQ><CProdNoSY>0364</CProdNoSY><CRatioTyp>340001</CRatioTyp><CSalegrpCde>05D70007</CSalegrpCde><CServiceProvider></CServiceProvider><CShareSlsTyp>199008</CShareSlsTyp><CSlsTyp>189009</CSlsTyp><CWeRisk>Z</CWeRisk><corigPlyNoJQ></corigPlyNoJQ><corigPlyNoSY></corigPlyNoSY><cprmCur>01</cprmCur><crenewMrkJQ>0</crenewMrkJQ><crenewMrkSY>0</crenewMrkSY><NAppTaxAmtJQ>51.17</NAppTaxAmtJQ><NAppTaxAmtSY>104.25</NAppTaxAmtSY><NBefTaxPrmJQ>852.83</NBefTaxPrmJQ><NBefTaxPrmSY>1737.54</NBefTaxPrmSY><NCommRateJQ>0.04</NCommRateJQ><NCommRateSY>0.16</NCommRateSY><NCommissionRateUpperJQ>0.04</NCommissionRateUpperJQ><NCommissionRateUpperSY>0.16</NCommissionRateUpperSY><NPrm>2745.79</NPrm><NPrmSY>1841.79</NPrmSY><NRatioCoef>1.0</NRatioCoef><namt>3503521.84</namt><namtSY>3303521.84</namtSY><TInsrncBgnTmJQ>2025-03-29 00:00:00</TInsrncBgnTmJQ><TInsrncBgnTmSY>2025-03-29 00:00:00</TInsrncBgnTmSY><TInsrncEndTmJQ>2026-03-28 23:59:59</TInsrncEndTmJQ><TInsrncEndTmSY>2026-03-28 23:59:59</TInsrncEndTmSY><cExceptionTyp>Typ004</cExceptionTyp><cHighriskvhlMrk>0</cHighriskvhlMrk><tLastBillDate>2024-03-25</tLastBillDate><tLastEndDateSY>2025-03-29 00:00:00</tLastEndDateSY><tLastStartDateSY>2024-03-29 00:00:00</tLastStartDateSY></Base><Vhl><CAppointAreaCode></CAppointAreaCode><CBizMrk>338003</CBizMrk><CBusType>0</CBusType><CBusTypeSy>0</CBusTypeSy><CCheckCodeJQ></CCheckCodeJQ><CCheckCodeSY></CCheckCodeSY><CChgOwnerFlag>0</CChgOwnerFlag><CDevice8Mrk></CDevice8Mrk><CDisplacementLvl>186</CDisplacementLvl><CEcdemicMrk>0</CEcdemicMrk><CEngNo>163146148</CEngNo><CFrmNo>LSGUL83L8HA031679</CFrmNo><CFstRegYm>2017-03-28</CFstRegYm><CGlassTyp></CGlassTyp><CInspectRec></CInspectRec><CInspectTm></CInspectTm><CInspectionCde>305005003</CInspectionCde><CInspectorNme></CInspectorNme><CModelCde>BKAAGD0072</CModelCde><CModelNme>别克SGM6522UAA2多用途乘用车</CModelNme><CMortgageMrk>0</CMortgageMrk><CNewMrk>1</CNewMrk><CPlateColor></CPlateColor><CPlateModelCde>BTYPBLUD0028</CPlateModelCde><CPlateNo>川T01981</CPlateNo><CPlateTyp>02</CPlateTyp><CQryCdeJQ>01AICS510025030202459197900539</CQryCdeJQ><CQryCdeSY>V0101AICS510025030272459199426</CQryCdeSY><CQuestionJQ></CQuestionJQ><CQuestionSY></CQuestionSY><CRegOwner>四川西部网信产业园有限公司</CRegOwner><CRegVhlTyp>K33</CRegVhlTyp><CResvTxt11></CResvTxt11><CResvTxt2>341003001</CResvTxt2><CResvTxt7></CResvTxt7><CUsageCde>336001</CUsageCde><CUseYear>341100007</CUseYear><CVhlCheck></CVhlCheck><CVhlTyp>337002</CVhlTyp><fuelType>32773001</fuelType><NActualValue>148358</NActualValue><NIlogUuid></NIlogUuid><NMonDespRate>0</NMonDespRate><NNewPriceValue>349900</NNewPriceValue><NNewPurchaseValue>133521.84</NNewPurchaseValue><NPoWeight>0</NPoWeight><NResvNum1>6</NResvNum1><NSeatNum>7</NSeatNum><NTonage>0</NTonage><noticeType></noticeType><ratingLevel></ratingLevel><specialDeclareReason></specialDeclareReason><TTransferDate></TTransferDate><TTransferTm></TTransferTm><wholeWeight>1.96</wholeWeight><cBuiResultFlag></cBuiResultFlag><cChdUbiData></cChdUbiData><cCheHuiScore></cCheHuiScore><cCheHuiScoreLevel></cCheHuiScoreLevel><cOperationVehicleProba></cOperationVehicleProba><cRiskScore></cRiskScore><cRkScore></cRkScore><cSuspectOperationVehicle></cSuspectOperationVehicle></Vhl><CarModel/><Vhlowner><CCity>511800</CCity><CCounty>511802</CCounty><COwnerCls>0</COwnerCls><COwnerNme>四川西部网信产业园有限公司</COwnerNme><CProvince>510000</CProvince><CSex>106002</CSex><CWorkdptKind>300</CWorkdptKind><TBirthday>0074-01-17</TBirthday></Vhlowner><CvrgListSY><cvrgSY><CCvrgNo>030006</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag>1</CPureRiskPremiumFlag><CResvTxt2>341003001</CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>56.78</NAppTaxAmt><NBasePrm>1343.49</NBasePrm><NBefAnnPrm>1791.32</NBefAnnPrm><NBefPrm>1791.32</NBefPrm><NBefTaxPrm>946.36</NBefTaxPrm><NCalcAnnPrm>1003.14</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt></NLiabDaysLmt><NPerAmt>133521.84</NPerAmt><NPrm>1003.14</NPrm><NPureRiskPremiun>1356.843</NPureRiskPremiun><NRate>0</NRate><NResvNum2>0</NResvNum2></cvrgSY><cvrgSY><CCvrgNo>030018</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag></CPureRiskPremiumFlag><CResvTxt2></CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>41.28</NAppTaxAmt><NBasePrm>976.62</NBasePrm><NBefAnnPrm>1302.16</NBefAnnPrm><NBefPrm>1302.16</NBefPrm><NBefTaxPrm>687.93</NBefTaxPrm><NCalcAnnPrm>729.21</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt></NLiabDaysLmt><NPerAmt>3000000</NPerAmt><NPrm>729.21</NPrm><NPureRiskPremiun></NPureRiskPremiun><NRate>0</NRate><NResvNum2>0</NResvNum2></cvrgSY><cvrgSY><CCvrgNo>030101</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag></CPureRiskPremiumFlag><CResvTxt2></CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>0.85</NAppTaxAmt><NBasePrm>20.18</NBasePrm><NBefAnnPrm>26.91</NBefAnnPrm><NBefPrm>26.91</NBefPrm><NBefTaxPrm>14.22</NBefTaxPrm><NCalcAnnPrm>15.07</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt>1</NLiabDaysLmt><NPerAmt>10000</NPerAmt><NPrm>15.07</NPrm><NPureRiskPremiun></NPureRiskPremiun><NRate>0.2018</NRate><NResvNum2>0</NResvNum2></cvrgSY><cvrgSY><CCvrgNo>030102</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag></CPureRiskPremiumFlag><CResvTxt2></CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>3.02</NAppTaxAmt><NBasePrm>71.4</NBasePrm><NBefAnnPrm>95.2</NBefAnnPrm><NBefPrm>95.2</NBefPrm><NBefTaxPrm>50.29</NBefTaxPrm><NCalcAnnPrm>53.31</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt>6</NLiabDaysLmt><NPerAmt>10000</NPerAmt><NPrm>53.31</NPrm><NPureRiskPremiun></NPureRiskPremiun><NRate>0.119</NRate><NResvNum2>0</NResvNum2></cvrgSY><cvrgSY><CCvrgNo>030208</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag></CPureRiskPremiumFlag><CResvTxt2></CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>2.32</NAppTaxAmt><NBasePrm>55</NBasePrm><NBefAnnPrm>73.33</NBefAnnPrm><NBefPrm>73.33</NBefPrm><NBefTaxPrm>38.74</NBefTaxPrm><NCalcAnnPrm>41.06</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt></NLiabDaysLmt><NPerAmt>100000</NPerAmt><NPrm>41.06</NPrm><NPureRiskPremiun></NPureRiskPremiun><NRate>0</NRate><NResvNum2>0</NResvNum2></cvrgSY><cvrgSY><CCvrgNo>030209</CCvrgNo><CIsMust></CIsMust><CPureRiskPremiumFlag></CPureRiskPremiumFlag><CResvTxt2></CResvTxt2><CResvTxt4></CResvTxt4><CTaxFree>1</CTaxFree><NAppTaxAmt>0</NAppTaxAmt><NBasePrm>0</NBasePrm><NBefAnnPrm>0</NBefAnnPrm><NBefPrm>0</NBefPrm><NBefTaxPrm>0</NBefTaxPrm><NCalcAnnPrm>0</NCalcAnnPrm><NCvrgTaxRate>0.06</NCvrgTaxRate><NLiabDaysLmt>2</NLiabDaysLmt><NPerAmt>0</NPerAmt><NPrm>0</NPrm><NPureRiskPremiun></NPureRiskPremiun><NRate>0</NRate><NResvNum2>0</NResvNum2></cvrgSY></CvrgListSY><PrmCoef><CClaimAdjustLevel>-2</CClaimAdjustLevel><CClaimAdjustReason></CClaimAdjustReason><CInsuranceGroup>JSGBZX</CInsuranceGroup><CNoClaimAdjustReason></CNoClaimAdjustReason><CTraSafFloRate></CTraSafFloRate><NAdditionalCostRate>0.25</NAdditionalCostRate><NAgoClmRecQuick>0.7</NAgoClmRecQuick><NAutonomyAdjust>1</NAutonomyAdjust><NChannelAdjust>1</NChannelAdjust><NClaimTimes>0</NClaimTimes><NInsureYears>2</NInsureYears><NPeccancyAdjustValue>1</NPeccancyAdjustValue><NPricingAdjustValue>0.8</NPricingAdjustValue><NResvNum3>0</NResvNum3><NResvNum5>0.35</NResvNum5><NTotDisc>0.56</NTotDisc><NUwdisc>0</NUwdisc><nabsoDedu>1</nabsoDedu></PrmCoef><FeeListSY><feeSY><CAppNo></CAppNo><CFeetypCde>A</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>278.01</NFee><NFeeProp>0.16</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y0</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>278.01</NFee><NFeeProp>0.16</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y1</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y2</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y3</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y5</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y10</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y11</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>Y12</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>036</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>364.88</NFee><NFeeProp>0.21</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>037</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY><feeSY><CAppNo></CAppNo><CFeetypCde>038</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeSY></FeeListSY><CVehiclePriceList/><CvrgListJQ><cvrgJQ><appTaxAmt>51.17</appTaxAmt><basicPremium>1130.0</basicPremium><befTaxPrm>852.83</befTaxPrm><beforeDiscountPremium>1130.0</beforeDiscountPremium><beforeDiscountYearPremium>1130.0</beforeDiscountYearPremium><coverageAmount>200000.0</coverageAmount><coverageCode>030050</coverageCode><coverageNumber>0</coverageNumber><coveragePremium>904.0</coveragePremium><coverageRate>0.0</coverageRate><coverageSeq>1</coverageSeq><cvrgTaxRate>0.06</cvrgTaxRate><maxAmount>852.83</maxAmount><minAmount>51.17</minAmount><originalPremium>904.0</originalPremium><taxFree>1</taxFree></cvrgJQ></CvrgListJQ><Tax><address>四川省雅安市雨城区沙湾路</address><annualTaxamt>360</annualTaxamt><calcFlag>1</calcFlag><calculatedType>349003001</calculatedType><calculatedTypeLastYear></calculatedTypeLastYear><conruty></conruty><currentTax>360</currentTax><decStatus>0</decStatus><declareDate></declareDate><department></department><endDateLastYear></endDateLastYear><exhaust>1.998</exhaust><formerTax>0</formerTax><idType>110004</idType><lastCompany></lastCompany><lastPaidYear></lastPaidYear><lateFee>0</lateFee><lateFeeChange>0.00</lateFeeChange><lateFeeValue>0.00</lateFeeValue><licenceType></licenceType><locationCode></locationCode><payChange>0.00</payChange><payChangeLastYear>0.00</payChangeLastYear><payEvidenceNo></payEvidenceNo><payLastYear>1</payLastYear><payNo></payNo><payValueCurrent>0.00</payValueCurrent><payValueLastYear>0.00</payValueLastYear><pcCode></pcCode><poCategory></poCategory><positionCode></positionCode><reduceNo></reduceNo><remark></remark><returnTaxFlag></returnTaxFlag><startDateLastYear></startDateLastYear><sumUpTax>360.0</sumUpTax><taxBeginDateCurrentYear>2025-01-01 00:00:00</taxBeginDateCurrentYear><taxBeginDateLastYear></taxBeginDateLastYear><taxBillType></taxBillType><taxBillingNo></taxBillingNo><taxCurrentType>349002001</taxCurrentType><taxDocumentDate></taxDocumentDate><taxEndDateCurrentYear>2025-12-31 00:00:00</taxEndDateCurrentYear><taxFreeAmount></taxFreeAmount><taxPaidAreaCode></taxPaidAreaCode><taxPaidDate>2025-03-20</taxPaidDate><taxPayerName>四川西部网信产业园有限公司</taxPayerName><taxPeriod></taxPeriod><taxPrintNo></taxPrintNo><taxReduceProp></taxReduceProp><taxReduceRsn></taxReduceRsn><taxReduceType></taxReduceType><taxStandard>0</taxStandard><taxerCode></taxerCode><taxpayerAddress>四川省雅安市雨城区沙湾路</taxpayerAddress><taxpayerNo>91511800740048106P</taxpayerNo><taxpayerType>338003</taxpayerType><tel>18140044628</tel><ticketType></ticketType><totalChange>0</totalChange><totalTaxValue>0.00</totalTaxValue><unitRate>360.0</unitRate><unittypeCde>1</unittypeCde><untaxedPolicyNo></untaxedPolicyNo><useStatus></useStatus><vehecleTypeDetail>3490010013</vehecleTypeDetail><vehicleCategory>K33</vehicleCategory><vehicleNo>川T01981</vehicleNo><vehicleQuality>1.96</vehicleQuality><vehicleType>349001001</vehicleType><zip></zip><cExceedDate></cExceedDate><cOverDueStartDate></cOverDueStartDate></Tax><Agent><agentBankType></agentBankType><agentCategory></agentCategory><agentCategoryNme></agentCategoryNme><agentCode>05D700P00016</agentCode><agentMajorType></agentMajorType><agentNme>成都衡信业保险代理有限公司邛崃分公司</agentNme><agentProfId>203254000000800</agentProfId><agentSaleNme>专业代理</agentSaleNme><agentStaffNme></agentStaffNme><agentStockMrk>189009</agentStockMrk><agentStockType>199008</agentStockType><agentType>191010</agentType><commissionProprortion>0.04</commissionProprortion><conferCode>05D700P0001601</conferCode><custNature>192098</custNature><dutyCde></dutyCde><dutyCnm></dutyCnm><extPrm>0.0</extPrm><extProp>0.0</extProp><fromCde></fromCde><qlftNo>203254000000800</qlftNo><subCoNo>05D700P0001601</subCoNo><supportServicePacket></supportServicePacket><supportServiceProvider></supportServiceProvider></Agent><VehicleAdjust><CInsuranceGroup>JSGBZX</CInsuranceGroup><drinkDrivingDealTime>0</drinkDrivingDealTime><drinkDrivingNonDealTime>0</drinkDrivingNonDealTime><drinkDrivingTime>0</drinkDrivingTime><drunkDrivingDealTime>0</drunkDrivingDealTime><drunkDrivingFloatingRate></drunkDrivingFloatingRate><drunkDrivingLastYear></drunkDrivingLastYear><drunkDrivingNonDealTime>0</drunkDrivingNonDealTime><drunkDrivingTime>0</drunkDrivingTime><dutyReparFloatingRate>0.8</dutyReparFloatingRate><JQRecordDanger>347026</JQRecordDanger><otherFirstNoProveYear></otherFirstNoProveYear><overCommitmentLastYear></overCommitmentLastYear><overallFloatingCoefficient>0.8</overallFloatingCoefficient><rateFloatFlag></rateFloatFlag><recDiscount>0.8</recDiscount><roadAccidentFloatingRate>347026</roadAccidentFloatingRate><roadAccidentFloatingRateValue>-20</roadAccidentFloatingRateValue><roadViolatFloatingRate>1</roadViolatFloatingRate><secondaryOrganization>05</secondaryOrganization><taxDiscount></taxDiscount><typeMismatchLastYear></typeMismatchLastYear><voilateRoadSignLastYear></voilateRoadSignLastYear><weDiscount></weDiscount><cInsuranceGroup>JSGBZX</cInsuranceGroup></VehicleAdjust><FeeListJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>Y0</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>34.11</NFee><NFeeProp>0.04</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>Y1</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>Y2</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>Y5</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>A</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>34.11</NFee><NFeeProp>0.04</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>036</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>037</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ><feeJQ><CAppNo></CAppNo><CFeetypCde>038</CFeetypCde><CSellfeeBusicls></CSellfeeBusicls><NFee>0.0</NFee><NFeeProp>0.0</NFeeProp><NGotPrm></NGotPrm></feeJQ></FeeListJQ><FixspecListJQ><fixspecDataJQ><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>1</seqNo><specContent>本保单保险费为含税金额，其中不含税保险费852.83元、增值税51.17元。</specContent><specNo>202100058</specNo></fixspecDataJQ><fixspecDataJQ><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>2</seqNo><specContent>所有权发生转移，应及时到保险公司办理变更，未办理变更手续，且因转让导致保险车辆危险程度显著增加而发生保险事故的，保险人不负赔偿责任。</specContent><specNo>202100024</specNo></fixspecDataJQ><fixspecDataJQ><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>3</seqNo><specContent>投保人同意保险公司将车险相关信息与政府部门、保险行业协会等相关第三方进行信息共享，用于风险防范、社会管理等目的。</specContent><specNo>202100009</specNo></fixspecDataJQ><fixspecDataJQ><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>4</seqNo><specContent>本保单车辆发生保险事故时，对事故车辆保险公司可以以不限于实物的方式进行赔付。</specContent><specNo>201900114</specNo></fixspecDataJQ></FixspecListJQ><FixspecListSY><fixspecDataSY><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>1</seqNo><specContent>本保单保险费为含税金额，其中不含税保险费1737.54元、增值税104.25元。</specContent><specNo>202100059</specNo></fixspecDataSY><fixspecDataSY><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>2</seqNo><specContent>保险车辆发生交通事故后应保留第一现场，并在48小时内通知保险公司，故意或因重大过失未及时通知，致使保险事故的性质、原因、损失程度等难以确定的，保险公司对无法确定的部分，不承担赔偿责任。</specContent><specNo>201500015</specNo></fixspecDataSY><fixspecDataSY><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>3</seqNo><specContent>收到本保险单后请认真核对，如与投保事实不符，请立即通知本公司采用保险批单更改,其他方式的更改无效；如超过48小时未提出异议的，视为投保人同意本保险单所载内容。</specContent><specNo>202100007</specNo></fixspecDataSY><fixspecDataSY><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>4</seqNo><specContent>所有权发生转移，应及时到保险公司办理变更，未办理变更手续，且因转让导致保险车辆危险程度显著增加而发生保险事故的，保险人不负赔偿责任。</specContent><specNo>202100008</specNo></fixspecDataSY><fixspecDataSY><modify>0</modify><ruleMrk>1</ruleMrk><seqNo>5</seqNo><specContent>本保单车辆发生保险事故时，对事故车辆保险公司可以以不限于实物的方式进行赔付。</specContent><specNo>201900114</specNo></fixspecDataSY></FixspecListSY><TfiWarnList><tfiWarnData/><tfiWarnData/></TfiWarnList></responseMessage></response></ns2:queryVehicleXnyQuotationServiceResponse></S:Body></S:Envelope>';*/

        $request = new PremiumInquiryRequest();
        if($premiumInquiryVisitor->getVehicleVisitor()->carKindCode == '100' && $premiumInquiryVisitor->getVehicleVisitor()->vehicleSeat < 10
            && !boolval($premiumInquiryVisitor->getVehicleVisitor()->isNewEnergy) && $premiumInquiryVisitor->getVehicleVisitor()->useNatureCode == '01'){

            $rateResponse = $this->getFloatRate($premiumInquiryVisitor);
            $rate = $rateResponse->printer->argc['negotiatePrice'] ?? 0;
            if(!empty($rate)){
                $premiumInquiryVisitor->getExtInfoVisitor()->argc['negotiatePrice'] = $rate;
            }
        }
        $request->setVisitor($premiumInquiryVisitor);

        //非车询价
        //$this->nonCarInquiry($premiumInquiryVisitor->getNonCarInquiryVisitor());

        /*** @var PremiumInquiryResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 核保
     * @param PremiumInquiryVisitor $premiumInquiryVisitor
     * @return UnderwritingResponse
     */
    public function underwriting(PremiumInquiryVisitor $premiumInquiryVisitor): UnderwritingResponse
    {
        $request = new UnderwritingRequest();
        $request->setVisitor($premiumInquiryVisitor);

        /*** @var UnderwritingResponse $response */
        $response = $this->execute($request);
        //非车核保
        if(!empty($premiumInquiryVisitor->getNonCarUnderwritingVisitor()->getNonCarList()) && $response->isSuccess()){
            /**@var NonCarUnderwritingPrinter $printer*/
            $printer = $response->printer->noCarUnderwritingPrinter;
            /*** @var NonCarProductVisitor $row */
            $row = $premiumInquiryVisitor->getNonCarUnderwritingVisitor()->getNonCarList()[0] ?? [];
            $list = $printer->getNonCarInquiryList();
            foreach ($list as $value){
                /**@var NonCarInquirySinglePrinter $value*/
                $value->planCode = $row->planCode;
                $value->productCode = $row->productCode;
            }
        }
        return $response;
    }

    /**
     * 支付
     * @param PolicyPaymentVisitor $paymentVisitor
     * @return PolicyPaymentResponse
     */
    public function policyPayment(PolicyPaymentVisitor $paymentVisitor): PolicyPaymentResponse
    {
        $request = new GetPaymentUrlRequest();
        $request->setVisitor($paymentVisitor);

        /*** @var PolicyPaymentResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 文件上传
     * @param UploadFileVisitor $uploadFileVisitor
     * @return UploadFileResponse
     */
    public function uploadFile(UploadFileVisitor $uploadFileVisitor): UploadFileResponse
    {
        $request = new UploadFileRequest();
        $list = $uploadFileVisitor->fileList;
        $response = new UploadFileResponse();
        foreach ($list as $val) {
            $visitor = new UploadFileVisitor();
            $visitor->argc = $uploadFileVisitor->argc;
            $visitor->ciInquiryNo = $uploadFileVisitor->ciInquiryNo;
            $visitor->biInquiryNo = $uploadFileVisitor->biInquiryNo;
            $visitor->fileAppend($val['type'], $val['url'], $val['base64']);
            $request->setVisitor($visitor);
            $response = $this->execute($request);
            sleep(1);
        }
        return $response;
    }

    /**
     * 投保单状态查询
     * @param ProposalStatusVisitor $proposalStatusVisitor
     * @return
     */
    public function proposalStatus(ProposalStatusVisitor $proposalStatusVisitor)
    {
        $request = new ProposalStatusRequest();
        $request->setVisitor($proposalStatusVisitor);

        return $this->execute($request);
    }

    /**
     * 撤单接口
     * @param ProposalRecallVisitor $revokeVisitor
     * @return ProposalRecallResponse
     */
    public function proposalRecall(ProposalRecallVisitor $revokeVisitor): ProposalRecallResponse
    {
        $request = new ProposalRecallRequest();
        $request->setVisitor($revokeVisitor);

        /*** @var ProposalRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 电子保单下载
     * @param EPolicyDownloadVisitor $EPolicyVisitor
     * @return EPolicyDownloadResponse
     */
    public function EPolicyDownload(EPolicyDownloadVisitor $EPolicyVisitor): EPolicyDownloadResponse
    {
        $request = new EPolicyDownloadRequest();
        $request->setVisitor($EPolicyVisitor);

        /*** @var EPolicyDownloadResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 核保撤回
     * @param UnderwritingRecallVisitor $recallVisitor
     * @return mixed|void
     */
    public function underwritingRecall(UnderwritingRecallVisitor $recallVisitor): UnderwritingRecallResponse
    {
        $request = new UnderwritingRecallRequest();
        $request->setVisitor($recallVisitor);

        /*** @var UnderwritingRecallResponse $response */
        $response = $this->execute($request);
        return $response;
    }

    /**
     * 保单详情
     * @param PolicyInfoVisitor $policyInfoVisitor
     * @return mixed|void
     */
    public function policyInfo(PolicyInfoVisitor $policyInfoVisitor)
    {
        $request = new PolicyInfoRequest();
        $request->setVisitor($policyInfoVisitor);

        $response = $this->execute($request);
        return $response;
    }

    /**
     * 非车产品列表
     * @param NonCarProductListVisitor $nonCarProductListVisitor
     * @return NonCarProductListResponse
     */
    public function nonCarProductList(NonCarProductListVisitor $nonCarProductListVisitor): NonCarProductListResponse
    {
        $request = new NonCarProductListRequest();
        $request->setVisitor($nonCarProductListVisitor);
        /*** @var NonCarProductListResponse $mainResponse */
        $mainResponse = $this->execute($request);

        foreach ($mainResponse->printer->productList as $sub) {
            $request->schemeNo = $sub->planCode;
            $this->execute($request,$mainResponse);
        }
        $mainResponse->printer->productList = array_values($mainResponse->printer->productList);

        return $mainResponse;
    }

    public function nonCarInquiry(NonCarInquiryVisitor  $nonCarInquiryVisitor)
    {
        // TODO: Implement nonCarInquiry() method.
    }

    public function nonCarUnderwriting(NonCarInquiryVisitor $inquiryPrinter)
    {
        // TODO: Implement nonCarUnderwriting() method.
    }

    /**
     * 获取意外险订单号
     * @param $orderCode
     * @return \IDock\Http\Response
     */
    public function accidentInsurance($orderCode)
    {
        $request = new AccidentInsuranceRequest();
        $request->orderCode = $orderCode;

        /*** @var AccidentInsuranceResponse $response */
        $response = $this->execute($request);
        return $response;
    }



}
